package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalServiceOfferConsts;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import com.ztesoft.bss.common.util.SpringUtil;
/**
 * 【客户经理性质】【一点结算】 河南专属
 * */
public class ArtenAccManaAttrHandler extends AbstractAttrHandler {

    @Override
    public void onShow(KiteAttr attr, KiteInst inst, AttrData data) {
        IQuerySceneInstService querySceneInstService = SpringUtil.getBean(IQuerySceneInstService.class);
        IOperateSceneInstService operateSceneInstService = SpringUtil.getBean(IOperateSceneInstService.class);
        String nodeCode = querySceneInstService.getExtParameterValue(data.getSceneInstId(), "nodeCode");
        String serviceOfferId = data.getServiceOfferId();
        //签订、追单、重提环节支持修改该业务属性
        if(KiteStringUtils.equalsAny(nodeCode,"OrderSigned","OrderResubmit")||
            KiteStringUtils.equalsAny(serviceOfferId, LocalServiceOfferConsts.SERVICE_OFFER_FOLLOW,"1",LocalServiceOfferConsts.SERVICE_OFFER_RESOURCE_CHECK)){
            attr.setIsEdit(KeyConsts.IFTRUE_T);
        }else {
            attr.setIsEdit(KeyConsts.IFTRUE_F);
        }
        operateSceneInstService.setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr);
    }
}
